<script setup lang="ts">
import YcDialog from "@/widget/dialog/YcLoading.vue";
// import { RouterLink, RouterView } from 'vue-router'
import { useRoute, useRouter } from "vue-router";
// import mRouterInstance from '@/router/index'
import { ref, toRef, watch } from "vue";
import { piniaKeepAlive } from "@/router/YcRouteHistory";
// import { piniaKeepAlive } from "@/pinia/YcPinia";

let mRouterInstance = useRouter()
const mKeepAlive = piniaKeepAlive()
let currentRoute = ref(mRouterInstance.currentRoute)
</script>

<template>
  <yc-dialog class="cs_loading" />
  <!-- <KeepAlive>
    <RouterView></RouterView>
  </KeepAlive> -->
  <!-- <router-view v-slot="{ Component }" v-if="mKeepAlive.mHasKeepAlive">
    <keep-alive>
      <component :is="Component" :key="currentRoute.name" />
    </keep-alive>
  </router-view>
  <router-view v-else v-slot="{ Component }">
    <component :is="Component" />
  </router-view> -->
  <div>alive:{{mKeepAlive.recordNames}}</div>
  <router-view v-slot="{ Component }">
    <keep-alive :include="mKeepAlive.recordNames">
      <component :is="Component" :key="currentRoute.name" />
    </keep-alive>
  </router-view>
</template>
<style scoped>
.cs_loading {
  width: 100%;
  height: 100%;
  position: absolute;
  overflow: hidden;
  z-index: 9999;
}
</style>

